apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: instances.deckhouse.io
  labels:
    heritage: deckhouse
    module: node-manager
spec:
  group: deckhouse.io
  scope: Cluster
  names:
    plural: instances
    singular: instance
    kind: Instance
  preserveUnknownFields: false
  versions:
    - name: v1alpha1
      served: true
      storage: true
      subresources:
        status: {}
      schema:
        openAPIV3Schema:
          type: object
          description: |
            Describes an implementation-independent ephemeral machine resource.
          properties:
            status:
              type: object
              properties:
                nodeRef:
                  type: object
                  description: Reference to the kubernetes node object.
                  properties:
                    name:
                      type: string
                      description: Node name
                classReference:
                  description: |
                    The reference to the `InstanceClass` object. It is unique for each `cloud-provider-*` module.
                  type: object
                  properties:
                    kind:
                      description: |
                        The object type (e.g., `OpenStackInstanceClass`). The object type is specified in the documentation of the corresponding `cloud-provider-` module.
                      type: string
                      enum:
                        - OpenStackInstanceClass
                        - GCPInstanceClass
                        - VsphereInstanceClass
                        - AWSInstanceClass
                        - YandexInstanceClass
                        - AzureInstanceClass
                        - VCDInstanceClass
                    name:
                      description: |
                        The name of the required `InstanceClass` object (e.g., `finland-medium`).
                      type: string
                machineRef:
                  type: object
                  description: Reference to instance in the cloud.
                  properties:
                    apiVersion:
                      type: string
                      description: APIVersion defines the versioned schema of this representation of an reference object.
                    kind:
                      type: string
                      description: Kind is a string value representing the REST resource referenced object represents.
                    name:
                      type: string
                      description: Name of referenced object.
                    namespace:
                      type: string
                      description: Namespace of referenced object.
                currentStatus:
                  type: object
                  description: Current status of the instance object.
                  properties:
                    lastUpdateTime:
                      description: Last update time of current status.
                      format: date-time
                      type: string
                    phase:
                      description: InstancePhase is a label for the condition of a instance at the current time.
                      type: string
                lastOperation:
                  description: Last operation refers to the status of the last operation performed.
                  properties:
                    description:
                      description: Description of the current operation.
                      type: string
                    lastUpdateTime:
                      description: Last update time of current operation.
                      format: date-time
                      type: string
                    state:
                      description: State of operation.
                      type: string
                    type:
                      description: Type of operation.
                      type: string
                  type: object
                bootstrapStatus:
                  type: object
                  description: Information about instance bootstrapping process.
                  properties:
                    logsEndpoint:
                      type: string
                      description: IP address for getting bootstrap logs.
                    description:
                      type: string
                      description: Description about getting logs.
      additionalPrinterColumns:
        - name: Status
          type: string
          description: Current status of the instance.
          jsonPath: .status.currentStatus.phase
        - name: Age
          type: date
          description: >
            CreationTimestamp is a timestamp representing the server time when this object was created.
            It is not guaranteed to be set in happens-before order across separate operations.
            Clients may not set this value. It is represented in RFC3339 form and is in UTC.
            Populated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
          jsonPath: .metadata.creationTimestamp
